package com.wenyu.wenyuyuedu.adapter.homepagefragment;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.wenyu.wenyuyuedu.R;
import com.wenyu.wenyuyuedu.view.CircleImageView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/2/27.
 * 我的关注的详情页打赏者头像的显示
 */

public class AttentionPlaytourCountAdapter extends BaseAdapter {
    private Context context;
    private List<String> mList;
    private CircleImageView playtour;
    private AttentionPlaytourCountAdapter.playtourHolder playtourHolder;
    private View inflate;

    public AttentionPlaytourCountAdapter(Context context) {
        this.context = context;
        mList = new ArrayList<>();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        playtourHolder = null;
        if (view == null) {
            playtourHolder = new playtourHolder();
            view = View.inflate(context, R.layout.attention_playtour_count_item, null);
            playtourHolder.iv_playtour = (CircleImageView) view.findViewById(R.id.iv_playtour);
            if (mList.size() > 0) {
                playtourHolder.iv_playtour.setVisibility(View.VISIBLE);
            }
            Glide.with(context)
                    .load(mList.get(i))
                    .error(R.drawable.login_logo)
                    .into(playtourHolder.iv_playtour);

        }

        return view;
    }

    class playtourHolder {
        ImageView iv_playtour;
    }

    public void addPlaytourAll(List<String> list) {
        if (list != null) {
            mList.clear();
            mList.addAll(list);
            notifyDataSetChanged();
        }
    }
}
